{% extends "models/front_simple.html" %}
{% block title %}Liste des documents{% endblock %}
{% block content %}
<form method="POST">
<div class="filtre">
	<div>
		<div class="libelle">Les documents de</div>
		<select class="middle" name="filtres[id_user]">
			<option {{ form.optionval(0, filtres.id_user) }}>Tout le monde</option>
			{% for user in documents_users %}
				<option {{ form.optionval(user.id_user, filtres.id_user) }}>{{ user.getUsername() }}</option>
			{% endfor %}
		</select>
	</div>
	<div>
		<div class="libelle">Mots-clés</div>
		<input type="text" name="filtres[keywords]" class="middle" value="{{ filtres.keywords }}" />
	</div>
	<div>
		<div class="libelle">Trier par</div>
		<select name="filtres[orderby]" class="middle">
			<option {{ form.optionval("last_update desc", filtres.orderby) }}>Documents les plus récents</option>
			<option {{ form.optionval("titre asc", filtres.orderby) }}>Titre du document</option>
		</select>
	</div>
	<div class="buttons">
		<input type="submit" name="logout" value="Filtrer la liste" class="button small" />
	</div>
</div>
</form>

{% for document in documents %}
<div class="bloc-document">
	<div class="titre"><a href="document_get_file.php?id={{ document.id_document }}">{{ document.titre }}</a></div>
	<div>
		<div class="icone">
			<a href="document_get_file.php?id={{ document.id_document }}"><img src="images/icons/files/{{ document.getFileType() }}.png" width="64" height="64"/></a>
		</div>
		<div style="float: left" class="informations">
			<div class="description">{{ document.description }}</div>
			<div>
				Par <span class="user">{{ document.user.getUsername() }}</span> le <span class="date">{{ document.last_update }}</span>
			</div>
		</div>
		<div style="clear: both"></div>
	</div>
</div>
{% endfor %}

{% endblock %}